<script setup lang='ts'>
  import { nextTick, reactive, ref } from 'vue';
  import { gamesApi, propApi } from '@/api/controller';
  import { ToastSuccess, ToastWarning, Toastloading, allNumber } from '@/utils/public';
  import xmImage from '@/components/xmImage/index.vue';
  const dataForm = ref()
  const $emit = defineEmits(['updateList'])
  const action = reactive({
    dialogFormVisible:false,
    disabled:false,
    title:'',
    list:[] as Array<any>,
  })
  const getList = async(pool_id:number)=> {
    const loading = Toastloading()
    const res = await gamesApi.wishLuckPoolConfigNum({
      pool_id
    })
    loading.close()
    const { data={} } = res || {}
    action.list = data
  }
  const openDialog = async(query:any={})=> {
    const { id=0, pool_name='' } = query
    action.title = `礼物池：${pool_name}-剩余数量`
    await getList(id)
    action.dialogFormVisible = true
  }
  defineExpose({
    openDialog
  })
</script>

<template>
  <div>
    <el-dialog
      top="5vh"
      class="xm-dialog xm-dialog-cont-y"
      v-model="action.dialogFormVisible"
      :close-on-click-modal="action.disabled"
      :close-on-press-escape="action.disabled"
      width="40%"
      :title="action.title">
      <el-table
        class="xm-TableCenter"
        :data="action.list"
        border
      >
        <el-table-column width="80" prop="gift_id" label="礼物ID" />
        <el-table-column min-width="120" prop="gift_name" label="礼物名称" />
        <el-table-column min-width="80" prop="gift_price" label="礼物价格" />
        <el-table-column min-width="80" prop="gift_num" label="配置数量" />
        <el-table-column min-width="80" prop="less_num" label="剩余数量" />
        <el-table-column min-width="80" prop="draw_num" label="产出数量" />
      </el-table>
    </el-dialog>
  </div>
</template>
